Next | Prev | Up | Top | Contents | Index
Restrictions on the ULI Handler
Because the ULI handler is called in a special context of the kernel's interrupt handler, it is severely restricted in the system facilities it can use. The list of features the ULI handler may not use includes the following:
- Any use of floating-point calculations. The kernel does not take time to save floating-point registers during an interrupt trap. The floating-point coprocessor is turned off and an attempt to use it in the ULI handler causes a SIGILL (illegal instruction) exception.
- Any use of IRIX system functions. Because most of the IRIX kernel runs with interrupts enabled, the ULI handler could be entered while a system function was already in progress. System functions do not support reentrant calls. In addition, many system functions can sleep, which an interrupt handler may not do.
- Any storage reference that causes a page fault. The kernel cannot suspend the ULI handler for page I/O. Reference to an unmapped page causes a SIGSEGV (memory fault) exception.
- Any calls to C library functions that might violate the preceding restrictions.
There are very few library functions that you can be sure will use no floating point and make no system calls. Unfortunately, library functions such as sprintf(), often used in debugging, must be avoided.
In essence, the ULI handler should only do such things as
- store data in program variables to record the interrupt event
A ring buffer is a data structure that is suitable for concurrent access.
- program the device as required to clear the interrupt or acknowledge it
The ULI handler has access to the whole program address space, including any mapped-in devices, so it can perform PIO loads and stores.
- post a semaphore to wake up the main process
This must be done using a ULI function.
Next | Prev | Up | Top | Contents | Index